<extend name="Common@Layout:hui-admin" />
<block name="title"><title>Administator管理后台</title></block>
<block name="style">
</block>

<block name="main">
<div class="pd-20">
	<form action="{:u('Contentadmin/standard_post')}" method="post" class="form form-horizontal validator_form close-dialog" id="form-article-add">
		<div id="tab-system" class="HuiTab">
			<div class="row cl">
				<label class="form-label col-2"><span class="c-red">*</span>模板名称：</label>
				<div class="formControls col-8">
					<input type="text" class="input-text" value="{$info.title}" placeholder="请输入模板名称" id="" name="title" data-rule="模板名称:required;">
				</div>
			</div>
			<div class="row cl">
					<label class="form-label col-2">模板描述：</label>
					<div class="formControls col-8">
						<textarea name="desc" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)">{$info.desc}</textarea>
						<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
					</div>
				</div>
			<div class="row cl">
				<label class="form-label col-2">规格：</label>
				<div class="formControls guige col-8">
					<div class="row cl">
						<label class="formControls col-2">规格名称</label>
						<label class="formControls col-8">规格属性</label>
						<label class="formControls col-2">操作</label>
					</div>
					<php>
						$list = json_decode($info['guige'],true);
					</php>
					<if condition="$list">
					<foreach name="list" item="vo">
					<div class="row cl">
						<label class="formControls col-2"><input type="text" class="input-text" value="{$key}" placeholder="规格名称"  name="guige_name[]"></label>
						<label class="formControls col-8"><input type="text" class="input-text" value="{$vo}" placeholder="多个规格属性以','分隔"  name="guige_cichun[]"></label>
						<label class="formControls col-2">
							<a href="javascript:;"  style="text-decoration:none" class="delguige"><i class="Hui-iconfont"></i></a>
						</label>
					</div>
					</foreach>
					<else/>
					<div class="row cl">
						<label class="formControls col-2"><input type="text" class="input-text" value="" placeholder="规格名称"  name="guige_name[]"></label>
						<label class="formControls col-8"><input type="text" class="input-text" value="" placeholder="多个规格属性以','分隔"  name="guige_cichun[]"></label>
						<label class="formControls col-2">
							<a href="javascript:;"  style="text-decoration:none" class="delguige"><i class="Hui-iconfont"></i></a>
						</label>
					</div>
					</if>
					<div class="row cl"><span class="addguige" style="cursor:pointer;">+添加</span></div>
				</div>
			</div>
		</div>
			
		
		<div class="row cl">
			<div class="col-10 col-offset-2">
				<input type="hidden" name="id" value="{$info.id}">
				<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
				<button onClick="parent.close_iframe_dialog();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</div>
</block>

<block name="script">

<script type="text/javascript">
$(".addguige").on('click',function(){
	var html_guige = '';
	html_guige = '<div class="row cl">';
	html_guige += '<label class="formControls col-2"><input type="text" class="input-text" value="" placeholder="规格名称"  name="guige_name[]"></label>';
	html_guige += '<label class="formControls col-8"><input type="text" class="input-text" value="" placeholder="多个规格属性以\',\'分隔" name="guige_cichun[]"></label>';
	html_guige += '<label class="formControls col-2">';
	html_guige += '<a href="javascript:;"  style="text-decoration:none" class="delguige"><i class="Hui-iconfont"></i></a>';
	html_guige += '</label>';
	html_guige += '</div>';
	
	$(this).parent().before(html_guige);
})
$(document).on('click','.delguige',function(){
	$(this).parent().parent().remove();
})
</script>
</block>